package com.mdd.common.mapper.shop;

import com.mdd.common.core.basics.IBaseMapper;
import com.mdd.common.entity.shop.Printer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface PrinterMapper extends IBaseMapper<Printer> {

    void editPrint(@Param("vo") Printer printer);

    // 通过订单获取有效果打印机信息
    List<Printer> getPrinterByOrderId(@Param("orderId")Integer orderId,@Param("only")String only);

    @Update("update la_printer set status = #{status} where id = #{id}")
    void changePrintStatus(@Param("id") Integer printer,@Param("status") Integer status);

    // 根据订单查询打印机编号  只查一个
    @Select("select b.secret from la_orders a left join la_printer b on a.aid =b.aid where a.id = #{id} and b.is_delete = '0' and b.status ='1' and b.print_belong =0")
    List<String> getPrintSNCode(@Param("id") Integer printer);
}
